home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / bbs / mhis020.zip / SEC.MH < prev    next >
Text File  |  1996-09-06  |  977b  |  37 lines

  1. #ifndef __SEC_MH
  2. #define __SEC_MH
  3.  
  4. #include "upchar.mh"
  5.  
  6. int get_class () {
  7.   int: idx;
  8.   int: classes;
  9.   int: priv;
  10.   char: key;
  11.  
  12.  
  13.   for (;;) {
  14.     print (COL_YELLOW +"\nAvailable privilage levels:\n\n");
  15.     classes := (int)class_info(0, CIT_NUMCLASSES);
  16.     for (idx := 0; idx < classes; idx := idx + 1) {
  17.       priv := class_info(idx,CIT_BYINDEX|CIT_LEVEL);
  18.       print ("  ", COL_YELLOW, (char)(class_info (idx,CIT_BYINDEX|CIT_CLASSKEY)));
  19.       print (COL_LCYAN, ") ", COL_GREEN);
  20.       print (class_name (priv), "\n");
  21.       };
  22.     print (COL_LBLUE + "\nSelect: ");
  23.     key := upChar (getch ());
  24.     print (key);
  25.     if (key = '\r') return -2;
  26.     for (idx := 0; idx < classes; idx := idx + 1) {
  27.       priv := class_info(idx,CIT_BYINDEX|CIT_LEVEL);
  28.       if (key = class_info (idx,CIT_BYINDEX|CIT_CLASSKEY)) {
  29.         return priv;
  30.         };
  31.       };
  32.     print (COL_WHITE + "\nSorry... that is not an option.\n");
  33.     };
  34.   }
  35.  
  36. #endif
  37.